/*
 * Copyright 2010 Alessandro Bellucci
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.soupframework.gwt.designerpanel.client.grid;

import com.google.gwt.user.client.Element;

public interface Grid {

	/**
	 * Sets the width of the grid
	 *
	 * @param width The width of the grid in pixel
	 */
	public void setPixelWidth(int width);

	/**
	 * Sets the height of the grid
	 *
	 * @param height The height of the grid in pixel
	 */
	public void setPixelHeight(int height);

	/**
	 * Sets the width and height of cells in the grid
	 *
	 * @param cellWidth The width of cells in the grid
	 * @param cellHeight The height of cells in the grid
	 */
	public void setGridCellSize(int cellWidth, int cellHeight);

	/**
	 * Gets the width of grid cells
	 *
	 * @return The width od grid cells
	 */
	public int getCellWidth();

	/**
	 * Gets the height of grid cells
	 *
	 * @return The height of grid cells
	 */
	public int getCellHeight();

	public static class GridVertex {
		private int x;
		private int y;

		public GridVertex(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		public int getX() {
			return x;
		}

		public int getY() {
			return y;
		}
	}

	/**
	 * Gets the grid vertex that is closest to the given point
	 *
	 * @param x X coord of the point
	 * @param y Y coord of the point
	 * @return The grid vertext that is closest to the given point
	 */
	public GridVertex getClosestGridVertex(int x, int y);

	/**
	 * Gets the DOM tree representing the grid
	 *
	 * @return The DOM for the grid
	 */
	public Element getElement();
}
